<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in">
      <div class="cornerComment-in-title">
        <span>添加/编辑导入学生信息excel</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-tabs v-model="activeName" type="card">
          <el-tab-pane label="添加导入学生信息" name="first">
            <addStudent ref="addExcelStudent" @getNewFn="getNewFn"></addStudent>
          </el-tab-pane>
          <el-tab-pane label="编辑导入学生信息" name="second">
            <editStudent ref="getExcelStudent" @getNewFn="getNewFn"></editStudent>
          </el-tab-pane>
          <el-tab-pane label="学生信息模版" name="third">
            <studentModle></studentModle>
          </el-tab-pane>
        </el-tabs>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="submitBook" size="small" type="primary" v-if="activeName=='first'||activeName=='second'">
          确定并保存
        </el-button>
        <el-button size="small">返回</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import addStudent from "./addStudent";
import editStudent from "./editStudent";
import studentModle from "./studentModle";

export default {
  props: ['visible'], // commoent 学生点评 collection 学生采集
  components: {
    addStudent,
    editStudent,
    studentModle
  },
  data() {
    return {
      dialogVisible: false,
      activeName: 'first'
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
    }
  },
  created() {

  },
  methods: {
    submitBook() {
      if (this.activeName === 'first') {
        this.$refs.addExcelStudent.sibmitFn();// 添加学生
      }
      if (this.activeName === 'second') {
        this.$refs.getExcelStudent.sibmitFn();// 编辑导入学生
      }
      // 判断新增 编辑
    },
    getNewFn(){
      this.$emit('InitFn')
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 50%;
  height: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 20px 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

</style>


